﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Text;

namespace Maticsoft222.BLL
{
    public class UserRole
    {
        Maticsoft222.DAL.UserRole ur = new Maticsoft222.DAL.UserRole();
        Maticsoft.DAL.Rights dal = new Maticsoft.DAL.Rights();
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List<Maticsoft.Model.Rights> GetModelList(string rolecode)
        {
            DataSet ds = ur.GetList(rolecode);
            return DataTableToList(ds.Tables[0]);
        }
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List<Maticsoft.Model.Rights> DataTableToList(DataTable dt)
        {
            List<Maticsoft.Model.Rights> modelList = new List<Maticsoft.Model.Rights>();
            int rowsCount = dt.Rows.Count;
            if (rowsCount > 0)
            {
                Maticsoft.Model.Rights model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = dal.DataRowToModel(dt.Rows[n]);
                    if (model != null)
                    {
                        modelList.Add(model);
                    }
                }
            }
            return modelList;
        }
    }
}
